home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / COMAL / B-Book Series / (k)b4.d64 / solution4.17 < prev    next >
Text File  |  2007-02-28  |  395b  |  18 lines

  1. 0010 DIM STACK(12), OP$ OF 4
  2. 0020 POINT:=1
  3. 0030 REPEAT 
  4. 0040 INPUT "PUSH OR POP?": OP$
  5. 0050 CASE OP$ OF
  6. 0060 WHEN "PUSH"
  7. 0070 INPUT "WHAT NUMBER DO YOU WISH TO STACK?": NUM
  8. 0080 STACK(POINT):=NUM
  9. 0090 POINT:=POINT+1
  10. 0100 WHEN "POP"
  11. 0110 POINT:=POINT-1
  12. 0120 IF POINT<1 THEN STOP 
  13. 0130 PRINT "POPPED ITEM IS";STACK(POINT)
  14. 0140 OTHERWISE 
  15. 0150 PRINT "INPUT ERROR"
  16. 0160 ENDCASE 
  17. 0170 UNTIL POINT>12
  18.